////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the Microsoft Public License (Ms-PL).
// See accompanying file License.txt or copy at http://mews.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Mews
{
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>Provides a generic <see cref="IVisitable{T}"/> implementation.</summary>
    /// <typeparam name="TDerived">The type directly or indirectly deriving from this class, usually the most-derived
    /// type.</typeparam>
    /// <typeparam name="TBase">The visitable base type.</typeparam>
    /// <threadsafety static="true" instance="false"/>
    public abstract class Visitable<TDerived, TBase> : IVisitable<TDerived, TBase>
        where TDerived : Visitable<TDerived, TBase>
        where TBase : IVisitable<TBase>
    {
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>See <see cref="IVisitable{T, U}"/>.</summary>
        public void Accept(IVisitor<TBase> visitor)
        {
            VisitableHelper.AcceptImpl(this, visitor);
        }
    }
}
